//
//  UIViewController+MS.m
//  TRSAnalytics
//
//  Created by 824810056 on 2018/3/8.
//  Copyright © 2018年 Miridescent. All rights reserved.
//

#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <objc/runtime.h>

@implementation UIViewController (MS)

//+ (void)load{
//    static dispatch_once_t onceToken;
//    dispatch_once(&onceToken,^{
//        Class class=[self class];
//        
//        SEL originalSelector=@selector(viewWillAppear:);
//        SEL swizzledSelector=@selector(MS_viewWillAppear:);
//        
//        Method originalMethod=class_getInstanceMethod(class,originalSelector);
//        Method swizzledMethod=class_getInstanceMethod(class,swizzledSelector);
//        
//        method_exchangeImplementations(originalMethod,swizzledMethod);
//        
////        BOOL didAddMethod=
////        class_addMethod(class,
////                        originalSelector,
////                        method_getImplementation(swizzledMethod),
////                        method_getTypeEncoding(swizzledMethod));
////        
////        if(didAddMethod){
////            class_replaceMethod(class,
////                                swizzledSelector,
////                                method_getImplementation(originalMethod),
////                                method_getTypeEncoding(originalMethod));
////        }
////        else{
////            method_exchangeImplementations(originalMethod,swizzledMethod);
////        }
//        
//        
//    });
//}
//-(void)MS_viewWillAppear:(BOOL)animated{
//    
//    
//    NSLog(@"MS == %@",NSStringFromClass(self.class));
//    //
//    //    if ([self.class isSubclassOfClass:UIViewController.class]) {
//    //
//    //        if ([self isKindOfClass:UIViewController.class]) {
//    //            UIViewController *controller = (UIViewController *)self;
//    //            NSLog(@"---------controller == :  %@",NSStringFromClass([controller class]));
//    //            NSLog(@"---------title:  %@",self.title);
//    //        }
//    //    }
//    
////    [self MS_viewWillAppear:animated];
//    
//    
//}
@end
